package com.rmi;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * Created with LXD
 *
 * @author:Luhui
 * @qq:729913162
 * @Date:2018-08-25
 * @Time:0:21
 */
public class SkeletonProxy extends Thread {


    private IHello target = new IHelloImpl();


    @Override
    public void run() {
        ServerSocket serverSocket=null;
        try{
            serverSocket = new ServerSocket(8888);
            while(true){
                Socket client = serverSocket.accept();
                byte[] buf = new byte[1024];
                int len = client.getInputStream().read(buf, 0, buf.length);
                String arg = new String(buf,0,len);
                target.hello(arg);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
